package com.endurance.service;


import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@Component
public class LifecycleService {

    @PreDestroy
    public void destroy() throws Exception {
        System.out.println("调用Bean的销毁回调1...");
        // do something...

    }

    @PostConstruct
    public void afterPropertiesSet() throws Exception {
        System.out.println("调用Bean的初始化回调1...");
        // do something...
    }

    @Override
    public String toString() {
        return "LifecycleService{}";
    }

}
